<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="sec" uri="http://www.springframework.org/security/tags" %>

<c:set var="title" value="用户管理"/>
<%@include file="common/adminHeader.jsp" %>
<c:set var="light" value="3"/>
<%@include file="common/adminNavigator.jsp" %>
<style>
    #tablelist span {
        height: 80px;
        line-height: 80px;
    }
    #btnSearch {
        width: 53px;
        height: 31px;
    }
</style>
<div class="container">
    <div class="right-top-box">
        <div class="btn bs-bars">
            <a class="btn-product" id="btn_add" title="添加">
                <i class="fa fa-plus fa-fw"></i>
            </a>
            <a class="btn-delete" id="btn_delete_ids" title="批量删除">
                <i class="fa fa-trash-o fa-fw"></i>
            </a>
        </div>
        <div class="row" id="tb">
            <div class="col-md-12">
                <form class="form-inline" id="resource-form">
                    <div class="group-inner">
                        <input type="text" class="form-control form-input" id="search-id" name="search-id" placeholder="ID">
                    </div>
                    <sec:authorize access="hasRole('ADMIN')">
                        <div class="group-inner">
                            <input type="text" class="form-control form-input" id="search-shop_id" name="search-shop_id" placeholder="店铺id">
                        </div>
                    </sec:authorize>
                    <sec:authorize access="hasAnyRole('SHOP_ADMIN')">
                        <div class="group-inner">
                            <input type="text" class="form-control form-input" id="search-email" name="search-email" placeholder="邮箱">
                        </div>
                    </sec:authorize>
                    <div class="group-inner">
                        <input type="text" class="form-control form-input" id="search-username" name="search-username"  placeholder="姓名">
                    </div>
                    <a class="btn btn-info glyphicon glyphicon-search form-search group-inner fa-search fa fa-fw" id="btnSearch" >
                    </a>
                </form>
            </div>
        </div>
    </div>
    <div class="modal fade" id="addOrUpdateModal" tabindex="-1" role="dialog" aria-labelledby="addroleLabel" data-backdrop="static" aria-hidden="false">
        <div class="modal-backdrop fade"></div>
        <div class="modal-dialog modal-lg" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
                    <h4 class="modal-title" id="addroleLabel">修改用户</h4>
                </div>
                <div class="modal-body">
                    <form id="addOrUpdateForm" class="form-horizontal form-label-left" novalidate="">
                        <input type="hidden" name="id" value="">
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="username">用户名 <span class="required">*</span></label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="text" class="form-control col-md-7 col-xs-12" name="username" id="username" required="required" placeholder="请输入用户名">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="password">密码 </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="text" class="form-control col-md-7 col-xs-12" id="password" name="password" placeholder="请输入密码 6位以上">
                            </div>
                        </div>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="email">邮箱 </label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <input type="text" class="form-control col-md-7 col-xs-12" name="email" id="email" placeholder="请输入邮箱">
                            </div>
                        </div>
                        <sec:authorize access="hasRole('ADMIN')">
                            <div class="item form-group">
                                <label class="control-label col-md-3 col-sm-3 col-xs-12" for="shop_id">店铺id </label>
                                <div class="col-md-6 col-sm-6 col-xs-12">
                                    <input type="text" class="form-control col-md-7 col-xs-12" name="shop_id" id="shop_id" data-validate-length-range="0,20" placeholder="请输入店铺id">
                                </div>
                            </div>
                        </sec:authorize>
                        <div class="item form-group">
                            <label class="control-label col-md-3 col-sm-3 col-xs-12" for="role">角色</label>
                            <div class="col-md-6 col-sm-6 col-xs-12">
                                <select class="form-control" name="role" id="role">
                                    <sec:authorize access="hasRole('ADMIN')">
                                        <option value="1">管理员</option>
                                        <option value="2">店长</option>
                                        <option value="3">店员</option>
                                        <option value="4">普通用户</option>
                                    </sec:authorize>
                                    <sec:authorize access="hasRole('SHOP_ADMIN')">
                                        <option value="3" selected>店员</option>
                                    </sec:authorize>
                                </select>
<%--                                <input type="number" class="form-control col-md-7 col-xs-12" name="role" id="role" placeholder="请输入角色">--%>
                            </div>
                        </div>
                    </form>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal"><i class="fa fa-close"> 关闭</i></button>
                    <button type="button" class="btn btn-success addOrUpdateBtn"><i class="fa fa-save">保存</i></button>
                </div>
            </div>
        </div>
    </div>
    <table id="tablelist"></table>
    <script type="text/javascript" src="render/js/manager/common.js"></script>
    <script type="text/javascript" src="render/js/manager/userManager.js"></script>
</div>
<%@include file="common/adminFooter.jsp" %>
</html>
